<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>申请审核 - 朋知云学</title>
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../css/admin.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@4.1.1/animate.min.css">
    <style>
        /* 申请审核页面特定样式 */
        .application-filter-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            flex-wrap: wrap;
            gap: 10px;
        }
        
        .filter-group {
            display: flex;
            gap: 10px;
            align-items: center;
        }
        
        .filter-select {
            padding: 8px 12px;
            border: 1px solid #ddd;
            border-radius: 4px;
            background-color: white;
        }
        
        .application-table-container {
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            overflow: hidden;
        }
        
        .user-avatar-sm {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .user-info {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .application-title {
            font-weight: 500;
            color: #333;
            margin-bottom: 5px;
        }
        
        .application-demand {
            font-size: 13px;
            color: #666;
        }
        
        .pagination {
            display: flex;
            justify-content: center;
            margin-top: 20px;
            gap: 5px;
        }
        
        .page-item {
            width: 35px;
            height: 35px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid #ddd;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        
        .page-item:hover, .page-item.active {
            background-color: #5bc0eb;
            color: white;
            border-color: #5bc0eb;
        }
        
        .status-badge {
            display: inline-block;
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 12px;
            font-weight: 500;
        }
        
        .status-pending {
            background-color: #fff3cd;
            color: #856404;
        }
        
        .status-approved {
            background-color: #d4edda;
            color: #155724;
        }
        
        .status-rejected {
            background-color: #f8d7da;
            color: #721c24;
        }
        
        .application-detail-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }
        
        .application-detail-modal.show {
            opacity: 1;
            visibility: visible;
        }
        
        .modal-content {
            background-color: white;
            border-radius: 8px;
            width: 90%;
            max-width: 800px;
            max-height: 90vh;
            overflow-y: auto;
            padding: 20px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            transform: translateY(20px);
            transition: transform 0.3s ease;
        }
        
        .application-detail-modal.show .modal-content {
            transform: translateY(0);
        }
        
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 1px solid #eee;
        }
        
        .modal-close {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
            color: #6c757d;
        }
        
        .application-detail-section {
            margin-bottom: 20px;
        }
        
        .application-detail-section h3 {
            margin-bottom: 10px;
            color: #343a40;
            font-size: 18px;
        }
        
        .detail-row {
            display: flex;
            margin-bottom: 10px;
        }
        
        .detail-label {
            width: 120px;
            font-weight: 500;
            color: #6c757d;
        }
        
        .detail-value {
            flex: 1;
        }
        
        .application-actions {
            display: flex;
            gap: 10px;
            margin-top: 20px;
            padding-top: 20px;
            border-top: 1px solid #eee;
        }
    </style>
</head>
<body>
    <!-- 页面加载动画 -->
    <div class="page-loader">
        <div class="loader"></div>
    </div>
    
    <!-- 管理员面板 -->
    <div class="admin-panel">朋知云学管理后台</div>
    
    <div class="admin-container">
        <!-- 侧边栏 -->
        <div class="admin-sidebar">
            <div class="admin-user">
                <div class="admin-user-info">
                    <div class="admin-username">管理员</div>
                    <div class="admin-role">超级管理员</div>
                </div>
            </div>
            
            <ul class="admin-sidebar-menu">
                <li class="admin-sidebar-item">
                    <a href="dashboard.html" class="admin-sidebar-link">
                        <i class="bi bi-speedometer2"></i>
                        <span>控制台</span>
                    </a>
                </li>
                <li class="admin-sidebar-item">
                    <a href="users.html" class="admin-sidebar-link">
                        <i class="bi bi-people"></i>
                        <span>用户管理</span>
                    </a>
                </li>
                <li class="admin-sidebar-item">
                    <a href="demands.html" class="admin-sidebar-link">
                        <i class="bi bi-list-check"></i>
                        <span>需求管理</span>
                    </a>
                </li>
                <li class="admin-sidebar-item active">
                    <a href="applications.html" class="admin-sidebar-link">
                        <i class="bi bi-file-earmark-text"></i>
                        <span>申请审核</span>
                    </a>
                </li>
                <li class="admin-sidebar-item">
                    <a href="settings.html" class="admin-sidebar-link">
                        <i class="bi bi-gear"></i>
                        <span>系统设置</span>
                    </a>
                </li>
                <li class="admin-sidebar-item">
                    <a href="../index.html" class="admin-sidebar-link">
                        <i class="bi bi-box-arrow-left"></i>
                        <span>返回前台</span>
                    </a>
                </li>
            </ul>
        </div>
        
        <!-- 主内容区 -->
        <div class="admin-content animate__animated animate__fadeIn">
            <div class="admin-header">
                <h1>申请审核</h1>
                <div class="admin-header-actions">
                    <div class="admin-search">
                        <i class="bi bi-search"></i>
                        <input type="text" placeholder="搜索申请..." id="application-search-input">
                    </div>
                    <div class="admin-notifications">
                        <i class="bi bi-bell"></i>
                        <span class="badge">3</span>
                    </div>
                </div>
            </div>
            
            <!-- 申请筛选栏 -->
            <div class="application-filter-bar">
                <div class="filter-group">
                    <select class="filter-select">
                        <option>所有状态</option>
                        <option>待审核</option>
                        <option>已通过</option>
                        <option>已拒绝</option>
                    </select>
                    <select class="filter-select">
                        <option>所有时间</option>
                        <option>今天</option>
                        <option>本周</option>
                        <option>本月</option>
                        <option>上个月</option>
                    </select>
                    <select class="filter-select">
                        <option>所有需求</option>
                        <option>语文教师</option>
                        <option>数学教师</option>
                        <option>英语教师</option>
                        <option>科学教师</option>
                    </select>
                </div>
                <button class="btn btn-primary">
                    <i class="bi bi-download"></i> 导出数据
                </button>
            </div>
            
            <!-- 申请表格 -->
            <div class="application-table-container">
                <table class="admin-table">
                    <thead>
                        <tr>
                            <th>
                                <input type="checkbox" id="select-all-applications">
                            </th>
                            <th>申请人</th>
                            <th>申请需求</th>
                            <th>申请时间</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <!-- 申请数据行 -->
                        <tr>
                            <td>
                                <input type="checkbox" class="application-checkbox">
                            </td>
                            <td>
                                <div class="user-info">
                                    <img src="../../static/avatar-default.png" alt="用户头像" class="user-avatar-sm">
                                    <span>张小明</span>
                                </div>
                            </td>
                            <td>
                                <div class="application-info">
                                    <div class="application-title">山区小学语文教师支教</div>
                                    <div class="application-demand">云南省丽江市宁蒗县</div>
                                </div>
                            </td>
                            <td>2023-09-15</td>
                            <td><span class="status-badge status-pending">待审核</span></td>
                            <td>
                                <div class="table-actions">
                                    <button class="btn-icon view-application" data-id="1" title="查看详情">
                                        <i class="bi bi-eye"></i>
                                    </button>
                                    <button class="btn-icon approve-application" title="通过">
                                        <i class="bi bi-check-circle"></i>
                                    </button>
                                    <button class="btn-icon reject-application" title="拒绝">
                                        <i class="bi bi-x-circle"></i>
                                    </button>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="checkbox" class="application-checkbox">
                            </td>
                            <td>
                                <div class="user-info">
                                    <img src="../../static/avatar-default.png" alt="用户头像" class="user-avatar-sm">
                                    <span>李华</span>
                                </div>
                            </td>
                            <td>
                                <div class="application-info">
                                    <div class="application-title">乡村初中英语教师招募</div>
                                    <div class="application-demand">四川省凉山州布拖县</div>
                                </div>
                            </td>
                            <td>2023-09-14</td>
                            <td><span class="status-badge status-approved">已通过</span></td>
                            <td>
                                <div class="table-actions">
                                    <button class="btn-icon view-application" data-id="2" title="查看详情">
                                        <i class="bi bi-eye"></i>
                                    </button>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="checkbox" class="application-checkbox">
                            </td>
                            <td>
                                <div class="user-info">
                                    <img src="../../static/avatar-default.png" alt="用户头像" class="user-avatar-sm">
                                    <span>王芳</span>
                                </div>
                            </td>
                            <td>
                                <div class="application-info">
                                    <div class="application-title">留守儿童课后辅导</div>
                                    <div class="application-demand">贵州省黔东南州黎平县</div>
                                </div>
                            </td>
                            <td>2023-09-13</td>
                            <td><span class="status-badge status-rejected">已拒绝</span></td>
                            <td>
                                <div class="table-actions">
                                    <button class="btn-icon view-application" data-id="3" title="查看详情">
                                        <i class="bi bi-eye"></i>
                                    </button>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="checkbox" class="application-checkbox">
                            </td>
                            <td>
                                <div class="user-info">
                                    <img src="../../static/avatar-default.png" alt="用户头像" class="user-avatar-sm">
                                    <span>赵明</span>
                                </div>
                            </td>
                            <td>
                                <div class="application-info">
                                    <div class="application-title">山区小学科学实验课教师</div>
                                    <div class="application-demand">甘肃省陇南市文县</div>
                                </div>
                            </td>
                            <td>2023-09-12</td>
                            <td><span class="status-badge status-pending">待审核</span></td>
                            <td>
                                <div class="table-actions">
                                    <button class="btn-icon view-application" data-id="4" title="查看详情">
                                        <i class="bi bi-eye"></i>
                                    </button>
                                    <button class="btn-icon approve-application" title="通过">
                                        <i class="bi bi-check-circle"></i>
                                    </button>
                                    <button class="btn-icon reject-application" title="拒绝">
                                        <i class="bi bi-x-circle"></i>
                                    </button>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            
            <!-- 分页 -->
            <div class="pagination">
                <div class="page-item"><i class="bi bi-chevron-left"></i></div>
                <div class="page-item active">1</div>
                <div class="page-item">2</div>
                <div class="page-item">3</div>
                <div class="page-item">...</div>
                <div class="page-item">5</div>
                <div class="page-item"><i class="bi bi-chevron-right"></i></div>
            </div>
        </div>
    </div>
    
    <!-- 申请详情模态框 -->
    <div class="application-detail-modal" id="applicationDetailModal">
        <div class="modal-content">
            <div class="modal-header">
                <h2>申请详情</h2>
                <button class="modal-close" id="closeModal">&times;</button>
            </div>
            <div class="modal-body">
                <div class="application-detail-section">
                    <h3>申请人信息</h3>
                    <div class="detail-row">
                        <div class="detail-label">姓名：</div>
                        <div class="detail-value">张小明</div>
                    </div>
                    <div class="detail-row">
                        <div class="detail-label">联系电话：</div>
                        <div class="detail-value">138****1234</div>
                    </div>
                    <div class="detail-row">
                        <div class="detail-label">邮箱：</div>
                        <div class="detail-value">zhangxm@example.com</div>
                    </div>
                    <div class="detail-row">
                        <div class="detail-label">所在地区：</div>
                        <div class="detail-value">北京市海淀区</div>
                    </div>
                </div>
                
                <div class="application-detail-section">
                    <h3>申请需求</h3>
                    <div class="detail-row">
                        <div class="detail-label">需求标题：</div>
                        <div class="detail-value">山区小学语文教师支教</div>
                    </div>
                    <div class="detail-row">
                        <div class="detail-label">需求地区：</div>
                        <div class="detail-value">云南省丽江市宁蒗县</div>
                    </div>
                    <div class="detail-row">
                        <div class="detail-label">支教时长：</div>
                        <div class="detail-value">3个月</div>
                    </div>
                    <div class="detail-row">
                        <div class="detail-label">学科：</div>
                        <div class="detail-value">语文</div>
                    </div>
                </div>
                
                <div class="application-detail-section">
                    <h3>申请说明</h3>
                    <p>尊敬的管理员，我是一名有5年教学经验的语文老师，曾在北京市某重点小学任教。我对支教工作充满热情，希望能够为山区的孩子们带去优质的教育资源。我擅长课堂活动设计和阅读教学，能够激发学生的学习兴趣。我已经做好了充分的准备，期待能够参与这次支教活动。</p>
                </div>
                
                <div class="application-detail-section">
                    <h3>教学经验</h3>
                    <p>2018年-至今 北京市海淀区某小学 语文教师<br>
                    2016年-2018年 北京市某教育机构 语文教师</p>
                </div>
                
                <div class="application-detail-section">
                    <h3>申请时间</h3>
                    <p>2023-09-15 14:30:25</p>
                </div>
                
                <div class="application-actions">
                    <button class="btn btn-success" id="approveBtn">通过申请</button>
                    <button class="btn btn-danger" id="rejectBtn">拒绝申请</button>
                    <button class="btn btn-secondary" id="cancelBtn">取消</button>
                </div>
            </div>
        </div>
    </div>

    <script src="../js/main.js"></script>
    <script src="../js/admin.js"></script>
    <script src="../js/applications.js"></script>
    <script>
        // 页面加载完成后隐藏加载动画
        window.addEventListener('load', function() {
            const pageLoader = document.querySelector('.page-loader');
            if (pageLoader) {
                pageLoader.style.opacity = '0';
                setTimeout(() => {
                    pageLoader.style.display = 'none';
                }, 500);
            }
        });
        
        // 申请详情模态框交互
        document.addEventListener('DOMContentLoaded', function() {
            const modal = document.getElementById('applicationDetailModal');
            const closeModal = document.getElementById('closeModal');
            const cancelBtn = document.getElementById('cancelBtn');
            const viewButtons = document.querySelectorAll('.view-application');
            
            // 打开模态框
            viewButtons.forEach(button => {
                button.addEventListener('click', function() {
                    const applicationId = this.getAttribute('data-id');
                    // 这里可以根据ID加载不同的申请详情
                    console.log('查看申请ID:', applicationId);
                    modal.classList.add('show');
                });
            });
            
            // 关闭模态框
            closeModal.addEventListener('click', function() {
                modal.classList.remove('show');
            });
            
            cancelBtn.addEventListener('click', function() {
                modal.classList.remove('show');
            });
            
            // 点击模态框外部关闭
            modal.addEventListener('click', function(e) {
                if (e.target === modal) {
                    modal.classList.remove('show');
                }
            });
            
            // 审核操作
            const approveBtn = document.getElementById('approveBtn');
            const rejectBtn = document.getElementById('rejectBtn');
            
            approveBtn.addEventListener('click', function() {
                alert('已通过申请');
                modal.classList.remove('show');
            });
            
            rejectBtn.addEventListener('click', function() {
                alert('已拒绝申请');
                modal.classList.remove('show');
            });
            
            // 表格中的审核按钮
            const approveButtons = document.querySelectorAll('.approve-application');
            const rejectButtons = document.querySelectorAll('.reject-application');
            
            approveButtons.forEach(button => {
                button.addEventListener('click', function() {
                    if (confirm('确定要通过这个申请吗？')) {
                        alert('申请已通过');
                    }
                });
            });
            
            rejectButtons.forEach(button => {
                button.addEventListener('click', function() {
                    if (confirm('确定要拒绝这个申请吗？')) {
                        alert('申请已拒绝');
                    }
                });
            });
            
            // 全选功能
            const selectAllCheckbox = document.getElementById('select-all-applications');
            const applicationCheckboxes = document.querySelectorAll('.application-checkbox');
            
            if (selectAllCheckbox) {
                selectAllCheckbox.addEventListener('change', function() {
                    applicationCheckboxes.forEach(checkbox => {
                        checkbox.checked = this.checked;
                    });
                });
            }
        });
    </script>
</body>
</html>